>> Are you even allowed to just take the address of the first element of a vector, and assume that everything is contiguous from that point?
Yes, the code you quoted is correct. The vector version has the advantage of automatic memory management as well, which is why it is preferred over your solution.